<?php
  
  class Association {
    
    
    private $_name;
    private $_class_name;
    private $_foreign_key;
    private $_conditions;
    private $_order;
    private $_dependant;
    private $_through;
    
    
    
    
    # Setters
    
    public function set_name($name) {
      $this->_name = trim($name);
    }
    
    public function set_class_name($class_name) {
      $this->_class_name = trim($class_name);
    }
    
    public function set_foreign_key($foreign_key) {
      $this->_foreign_key = trim($foreign_key);
    }
    
    public function set_conditions($conditions) {
      $this->_conditions = trim($conditions);
    }
    
    public function set_order($order) {
      $this->_order = trim($order);
    }
    
    public function set_dependant($dependant) {
      $this->_dependant = $dependant;
    }
    
    public function set_through($through) {
      $this->_through = trim($through);
    }
    
    
    
    
    # Getters
    
    public function name() {
      return $this->_name;
    }
    
    public function class_name() {
      return $this->_class_name;
    }
    
    public function foreign_key() {
      return $this->_foreign_key;
    }
    
    public function conditions() {
      return $this->_conditions;
    }
    
    public function order() {
      return $this->_order;
    }
    
    public function dependant() {
      return $this->_dependant;
    }
    
    public function through() {
      return $this->_through;
    }
    
    public function params() {
      $params = array();
      if (trim($this->order()) != '') {
        $params['order_by'] = $this->order();
      }
      if (trim($this->conditions()) != '') {
        $params['conditions'] = $this->conditions();
      }
      return $params;
    }
    
    
  }
  
?>